package com.zhoupeisen.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCollapser;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.zhoupeisen.command.OrderCommand;
import com.zhoupeisen.entity.Product;
import com.zhoupeisen.feign.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @ClassName OrderController
 * @Description TODO
 * @Author Administrator
 * @Data 下午 03:52
 * @Version 1.0
 **/
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    DiscoveryClient discoveryClient;
    @Autowired
    RestTemplate restTemplate;
    @Autowired
    ProductFeignClient productFeignClient;

    // 使用Feign远程调用
    @RequestMapping(value = "/buy/{id}",method = RequestMethod.GET)
    public Product findById(@PathVariable Long id){
        return productFeignClient.findById(id);
    }


}
